package com.tao.china.translate.impl.baidu.enums;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 百度错误枚举
 */
public enum EnumBaiduErrorCode {
    
    
    OPEN_API_REQUEST_LIMIT_REACHED("4","Open api request limit reached");
    
    private String  errorCode;
    private String  errorMsg;

    private static Map<String, EnumBaiduErrorCode> pool = new HashMap<String, EnumBaiduErrorCode>();
    static {
        for (EnumBaiduErrorCode et : EnumBaiduErrorCode.values()) {
            pool.put(et.errorCode, et);
        }
    }
    
    public static Map<String, String> toMap() {
        Map<String, String> enumDataMap = new HashMap<String,String>();
        for (EnumBaiduErrorCode type : EnumBaiduErrorCode.values()) {
            enumDataMap.put(type.errorCode, type.getErrorMsg());
        }
        return enumDataMap;
    }
    
    public static List<EnumBaiduErrorCode> toList() {
        return Arrays.asList(EnumBaiduErrorCode.values());
    }
    
    public static EnumBaiduErrorCode indexByValue(String value) {
        return pool.get(value);
    }

    private EnumBaiduErrorCode(String errorCode, String errorMsg) {
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    public String getErrorCode() {
        return this.errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMsg() {
        return this.errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }
    
    



}
